package com.zzq.controller;


import com.aliyuncs.exceptions.ClientException;
import com.zzq.domain.dto.SmilePhotographerDTO;
import com.zzq.result.SmileResult;
import com.zzq.domain.entity.SmilePhotographer;
import com.zzq.service.PhotographerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/photographer")
@Api(value = "摄影师角色控制接口", tags = {"摄影师角色控制接口"})
public class PhotographerController {

    @Autowired
    PhotographerService photographerLoginSerice;

    @PostMapping("/login")
    @ApiOperation("摄影师登录接口")
    public SmileResult login(@RequestBody SmilePhotographer photographer) {
        return photographerLoginSerice.photographerLogin(photographer);
    }

    @PostMapping("/loginout")
    @ApiOperation("摄影师登出接口")
    public SmileResult login() {
        return photographerLoginSerice.photographerLoginOut();
    }

    @PostMapping("/register/{code}")
    @ApiOperation("摄影师注册接口")
    public SmileResult register(@PathVariable("code")String code,@RequestBody SmilePhotographer photographer) {
        return photographerLoginSerice.photographerRegister(code,photographer);
    }

    @PostMapping("/setavtatar")
    @ApiOperation("摄影师头像设置接口")
    public SmileResult setAvatar(MultipartFile file) throws IOException, ClientException {
        return photographerLoginSerice.setAvatar(file);
    }

    @GetMapping("/info/byid")
    @ApiOperation("通过ID获取摄影师详情信息")
    public SmileResult getPhotographerInfoById(@RequestParam("photographerId") Long photographerId){
      return   photographerLoginSerice.getPhotographerInfoById(photographerId);
    }

    @GetMapping("/kpi/byid")
    @ApiOperation("获取摄影师kpi")
    public SmileResult getPhotographerKpiById(@RequestParam("photographerId") Long photographerId){
        SmileResult photographerInfoById = photographerLoginSerice.getPhotographerKpiById(photographerId);
        return   photographerInfoById;
    }



    @PostMapping("/upd/bank")
    @ApiOperation("设置银行卡信息")
    public SmileResult updPhotographerBank(@RequestBody SmilePhotographerDTO smilePhotographerDTO){
     return   photographerLoginSerice.setPhotographerBank(smilePhotographerDTO);
    }


    @GetMapping("/withdraw")
    @ApiOperation("提现")
    public SmileResult withdraw(@RequestParam("photographerId") Long photographerId){
        return photographerLoginSerice.withdraw(photographerId);
    }
    @GetMapping("/withdraw/record/byid")
    @ApiOperation("提现")
    public SmileResult getWithdrawRecordById(@RequestParam("photographerId") Long photographerId){
      return   photographerLoginSerice.getWithdrawRecordById(photographerId);
    }






}
